<%@ include file="base.jsp" %>
<%@ page language="java"%>
<%@ page import="net.amsoft.iservice.icontact.util.IContactConstants" %>
<%@ page import="net.amsoft.iservice.icontact.webapp.struts.form.ConfigForm" %>
<%@ page import="java.util.ArrayList" %>
<%@ page import="org.apache.struts.util.LabelValueBean" %>
<%@ page import="java.util.Iterator" %>
<%@ page import="net.amsoft.iservice.icontact.hibernate.IBroker" %>
<%@ page import="net.amsoft.iservice.icontact.hibernate.dataObject.LoginData" %>
<%@ page import="net.amsoft.iservice.icontact.service.IContact" %>
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html"%>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic"%>
<%@ taglib uri="http://struts.apache.org/tags-tiles" prefix="tiles"%>
<%
	// Service URLs
	String issoURL = "#";
	String forwardingURL = "#";
	// Get IBroker Data
	IBroker oIBroker = IContact.getIBroker(request.getServerName());
	// Get loggedInSynonym
	LoginData oLoginData = (LoginData) session.getAttribute(IContactConstants.SESSION_LOGIN_OBJ);
	if ((oIBroker!=null) && (oLoginData!=null))
	{
		issoURL = oIBroker.getIssoURL() + oLoginData.getLoggedInSynonym();
		forwardingURL = oIBroker.getForwardingURL() + oLoginData.getLoggedInSynonym();
	}
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
	<script language="javascript" src="js/email.js"></script>
	<script src="js/help.js"></script>
	<script language="JavaScript" src="js/configure.js" ></script>
	<meta content="text/html; charset=UTF-8" http-equiv="content-type" />
	<title><bean:message key="title.configure" /></title>
	<link rel="stylesheet" type="text/css" href="styleSheets/iservices.css" />
</head>
<body >
<center>
<table cellspacing=25 border=0 cellpadding=0 width="800">
	<%@ include file="leftMenu.jsp" %>	
	<%  ConfigForm oConfigForm=(ConfigForm)request.getAttribute("ConfigForm");
		String sInputSize="48";
		String sTextCols="45"; %>
	<td width="605" valign="top">
		<table border="0" cellspacing="0" cellpadding="0" width="100%">
			<tr valign="bottom"><td colspan=8 align="left" height="23px" width="100%"><a href="<%=issoURL%>"><img src="<%=imagePath%>/tab-noclick-isso.jpg" border="0" onmouseover="this.src='<%=imagePath%>/tab-rollover-isso.jpg'" onmouseout="this.src='<%=imagePath%>/tab-noclick-isso.jpg'" /></a><img src="<%=imagePath%>/tab-click-contact.jpg" border="0" onmouseover="this.src='<%=imagePath%>/tab-rollover-contact.jpg'" onmouseout="this.src='<%=imagePath%>/tab-click-contact.jpg'" /><a href="<%=forwardingURL%>"><img src="<%=imagePath%>/tab-noclick-forwarding.jpg" border="0" onmouseover="this.src='<%=imagePath%>/tab-rollover-forwarding.jpg'" onmouseout="this.src='<%=imagePath%>/tab-noclick-forwarding.jpg'" /></a></td></tr>
			<tr height="45" valign="middle">
				<td rowspan=9 valign="middle" width="10" bgcolor="#999999"><img src="<%=imagePath%>/grey-square.gif"></td>
				<td colspan="2" align="left" bgcolor="#999999"><img src="<%=imagePath%>/title_contact_configure.gif"></td>
				<td bgcolor="#999999" align="left" width=100%><b class="blue-smalltext" style="font-size:12px;text-align:left" ><%=oConfigForm.getSynonym()%></b></td>
				<td bgcolor="#999999"><html:link  action="/CheckLogin" ><img border="0" src="<%=imagePath%>/button-home.jpg" alt="home" ></html:link></td>
				<td width="10" bgcolor="#999999">&nbsp;</td>
				<td bgcolor="#999999"><html:link  action="/Logout" ><img border="0" src="<%=imagePath%>/button-logout.jpg" alt="logout" ></html:link></td>
				<td rowspan=9 valign="middle" width="10" bgcolor="#999999"><img src="<%=imagePath%>/grey-square.gif"></td>
			</tr>
			<tr>
				<td colspan="6">
					<table border="0" cellspacing="0" cellpadding="0" width="100%">
<!------------------------------------>
						<tr bgcolor="#CCCCCC">
							<td width="25">&nbsp;</td>
							<td colspan="3" class="blue-smalltext" align="left" >
							<% if(oConfigForm.getType().equals(IContactConstants.TYPE_GROUP_ACTIVATED)) {
									out.print(oConfigForm.getSynonym());%><b><bean:message key="label.configure.group" /></b><%
									ArrayList groupList=(ArrayList)request.getAttribute(IContactConstants.REQ_GRP_SYNONYMS);
									for(int groupCount=0;groupCount<groupList.size();groupCount++){
											LabelValueBean labelValueBean=(LabelValueBean)groupList.get(groupCount);
										if(labelValueBean.getLabel().equals(oConfigForm.getSameAsSynonyms())){
											out.print(labelValueBean.getValue());
											break;
										}
									}
								}else{%><b><bean:message key="label.configure.no.group" /></b><%}%>
							</td>
						</tr>
						<form action="/icontact/Config" name="ConfigForm" method="post">
						<input type="hidden" name="<%=IContactConstants.REQ_LAST_TYPE%>" value='<%=oConfigForm.getType()%>' />
						<input type="hidden" name="synonym" value='<%=oConfigForm.getSynonym()%>' />
						<input type="hidden" name="<%=IContactConstants.REQ_PTR_STEP%>" value="<%=IContactConstants.REQ_PTR_STEP_CANCEL%>" />
						<input type="hidden" name="type" value="<%=IContactConstants.TYPE_ACTIVATED_SEPARATE%>" />
						<logic:notEmpty name="<%=IContactConstants.REQ_GRP_SYNONYMS%>">
						<tr bgcolor="#CCCCCC" valign="middle"><td colspan="4" height="8px"><img width="100%" height="2px" src="<%=imagePath%>/dotted-line.gif" /></td></tr>
						<tr bgcolor="#CCCCCC" valign="top">
							<td>&nbsp;</td>
							<td><font class="heading_2"><bean:message key="label.configure.share"/></font></td>
							<td colspan="2" width="420" class="blue-smalltext"><b class="textarea-smalltext"><bean:message key="label.configure.sameas"/></b><br/>
								<%ArrayList grpSynList=(ArrayList)request.getAttribute(IContactConstants.REQ_GRP_SYNONYMS);
								  for(Iterator iter=grpSynList.iterator();iter.hasNext();){
									    LabelValueBean lableValueBean=(LabelValueBean)iter.next();%>
									  <input type="radio" name="sameAsSynonyms" value="<%=lableValueBean.getLabel()%>" <%=(lableValueBean.getLabel().equals(oConfigForm.getSameAsSynonyms()) == true? "checked":"")%>><%=lableValueBean.getValue()%><br>
								 <%}%>
							</td>
						</tr>
						<tr bgcolor="#CCCCCC">
							<td colspan=2>&nbsp;</td>
							<td colspan="2" align="left"><a class="link-nounderline" href="#" accesskey="enter"><img border="0" src="<%=imagePath%>/button-confirm-red.jpg" onclick="submitEditForm('<%=IContactConstants.REQ_PTR_STEP_SAVE%>','<%=IContactConstants.TYPE_GROUP_ACTIVATED%>');" alt="confirm"/></a></td>
						</tr>
						</logic:notEmpty>
						<%if(!oConfigForm.getType().equals(IContactConstants.TYPE_DEACTIVATED)){%>
						<tr bgcolor="#CCCCCC" valign="middle"><td colspan="4" height="8px"><img width="100%" height="2px" src="<%=imagePath%>/dotted-line.gif" /></td></tr>
						<tr bgcolor="#CCCCCC">
							<td>&nbsp;</td>
							<td colspan="3"><font class="heading_2"><bean:message key="label.configure.edit"/>&nbsp;</font><a class="link-nounderline" href="#" accesskey="enter" onclick="toggleItem('rowEdit','rowNew','editOpenImgID','newOpenImgID','<%=imagePath%>/button-open.jpg','<%=imagePath%>/button-close.jpg'	)"><img id="editOpenImgID" border="0" src="<%=imagePath%>/button-open.jpg" alt="edit" /></a></td>
						</tr>
						<tr bgcolor="#CCCCCC" id="rowEdit" style="display: none;">
							<td>&nbsp;</td>
							<td colspan="3">
								<table cellspacing="5" border="0" width="100%">
									<tr>
										<td class="black-smalltext" valign="top" align="left"><bean:message key="label.disp.name" /></td>
										<td><input type="text" name="displayName" size="<%=sInputSize%>" maxlength="40" class="textbox" value="<%=oConfigForm.getDisplayName()%>"/></td>
									</tr>
									<tr>
										<td class="black-smalltext" valign="top" align="left"><bean:message key="label.disp.msg" /><br><b class="blue-xsmalltext"><bean:message key="label.max.limit" arg0="255" /></b></td>
										<td class="textbox"><TEXTAREA name="displayMsg" rows="10" cols="<%=sTextCols%>"	class="textarea-smalltext" onkeyup="checkLength('displayMsg');" onmouseout="checkLength('displayMsg');" ><%=oConfigForm.getDisplayMsg()%></TEXTAREA></td>
									</tr>
									<tr>
										<td class="black-smalltext" valign="top" align="left"><bean:message key="label.ver.type" /></td>
										<td class="textbox"><input type="radio" name="verificationType" value="1" <%=("1".equals(oConfigForm.getVerificationType()) == true? "checked":"")%>><bean:message key="label.ver.iname" /><br/><input type="radio" name="verificationType" value="2" <%=("2".equals(oConfigForm.getVerificationType()) == true? "checked":"")%>><bean:message key="label.ver.email" /><br/><input type="radio" name="verificationType" value="0" <%=("0".equals(oConfigForm.getVerificationType()) == true? "checked":"")%>><bean:message key="label.ver.none" /><br/></td>
									</tr>
									<tr>
										<td class="black-smalltext" valign="top" align="left"><bean:message key="label.ver.sub" /></td>
										<td class="textbox"><input type="text" name="verificationEmailSub" size="<%=sInputSize%>" maxlength="40" class="textbox" value="<%=oConfigForm.getVerificationEmailSub()%>"/></td>
									</tr>
									<tr>
										<td class="black-smalltext" valign="top" align="left"><bean:message key="label.ver.msg" /><br><b class="blue-xsmalltext"><bean:message key="label.max.limit" arg0="255"/></b></td>
										<td class="textbox"><textarea name="verificationEmailMsg" rows="10" cols="<%=sTextCols%>" class="textarea-smalltext" onkeyup="checkLength('verificationEmailMsg');"	onmouseout="checkLength('verificationEmailMsg');" ><%=oConfigForm.getVerificationEmailMsg()%></textarea></td>
									</tr>
									<tr>
										<td class="black-smalltext" valign="top" align="left"><bean:message key="label.not.addr" /></td>
										<td class="textbox"><textarea name="emailAddresses" rows="3" cols="<%=sTextCols%>" class="textarea-smalltext" onkeyup="checkLength('emailAddresses');" onmouseout="checkLength('emailAddresses');" ><%=oConfigForm.getEmailAddresses()%></textarea></td>
									</tr>
									<tr>
										<td class="black-smalltext" valign="top" align="left"><bean:message key="label.not.sub" /></td>
										<td class="textbox"><input type="text" name="notificationEmailSub" size="<%=sInputSize%>" maxlength="40" class="textbox" value="<%=oConfigForm.getNotificationEmailSub()%>"></td>
									</tr>
									<tr>
										<td class="black-smalltext" valign="top" align="left"><bean:message key="label.not.msg" /><br><b class="blue-xsmalltext"><bean:message key="label.max.limit" arg0="255"/></b></td>
										<td><textarea name="notificationEmailMsg" rows="10" cols="<%=sTextCols%>" class="textarea-smalltext" onkeyup="checkLength('notificationEmailMsg');"	onmouseout="checkLength('notificationEmailMsg');" ><%=oConfigForm.getNotificationEmailMsg()%></textarea></td>
									</tr>
									<tr>
										<td class="black-smalltext" valign="top" align="left"><bean:message key="label.tags" /><br><b class="blue-xsmalltext"><bean:message key="label.max.limit" arg0="255"/></b></td>
										<td class="black-smalltext"><textarea name="tags" rows="3" cols="<%=sTextCols%>" class="textarea-smalltext" onkeyup="checkLength('tags');" onmouseout="checkLength('tags');" ><%=oConfigForm.getTags()%></textarea></td>
									</tr>
									<tr>
										<td>&nbsp;</td>
										<td align="left"><a class="link-nounderline" href="#" ><img src="<%=imagePath%>/button-preview.jpg" border="0" onclick="preview('2');" alt="preview" /></a>&nbsp;<a class="link-nounderline" href="#" ><img border="0" src="<%=imagePath%>/button-confirm-red.jpg" onclick="submitEditForm('<%=IContactConstants.REQ_PTR_STEP_SAVE%>','<%=oConfigForm.getType().equals(IContactConstants.TYPE_GROUP_ACTIVATED)?IContactConstants.TYPE_ACTIVATE_EDIT:IContactConstants.TYPE_ACTIVATED_SEPARATE%>');" alt="confirm"/></a></td>
									</tr>
								</table>
							</td>
						</tr>
						</form>
						<%}//if not deactivated %>	
						<tr bgcolor="#CCCCCC" valign="middle"><td colspan="4" height="8px"><img width="100%" height="2px" src="<%=imagePath%>/dotted-line.gif" /></td></tr>
						<tr bgcolor="#CCCCCC">
							<td>&nbsp;</td>
							<td colspan="3"><font class="heading_2"><bean:message key="label.configure.new"/>&nbsp;</font><a class="link-nounderline" href="#" accesskey="enter" onclick="toggleItem('rowNew','rowEdit','newOpenImgID','editOpenImgID','<%=imagePath%>/button-open.jpg','<%=imagePath%>/button-close.jpg')"><img id="newOpenImgID" border="0" src="<%=imagePath%>/button-open.jpg" alt="new" /></a></td>
						</tr>
<!--============================== DUMMY FORM ============================== -->
		<%if(!oConfigForm.getType().equals(IContactConstants.TYPE_DEACTIVATED)){%>
			<form name="dummyForm" action="">
		<%}%>
			<tr bgcolor="#CCCCCC" id="rowNew" style="display: none;">
				<td>&nbsp;</td>
				<td colspan="3">
					<table cellspacing="5" border="0" width="100%">
						<tr>
							<td class="black-smalltext" valign="top" align="left"><bean:message key="label.disp.name" /></td>
							<td><input type="text" name="displayName" size="<%=sInputSize%>" maxlength="40" class="textbox"  value=""/></td>		
						</tr>
						<tr>
							<td class="black-smalltext" valign="top" align="left"><bean:message key="label.disp.msg" /><br><b class="blue-xsmalltext"><bean:message key="label.max.limit" arg0="255" /></b></td>
							<td class="textbox"><TEXTAREA name="displayMsg" rows="10" cols="<%=sTextCols%>"	class="textarea-smalltext" onkeyup="checkLength('displayMsg');" onmouseout="checkLength('displayMsg');" ></TEXTAREA></td>
						</tr>
						<tr>
							<td class="black-smalltext" valign="top" align="left"><bean:message key="label.ver.type" /></td>
							<td class="textbox"><input type="radio" name="verificationType" value="1" ><bean:message key="label.ver.iname" /><br/><input type="radio" name="verificationType" value="2" checked="checked"><bean:message key="label.ver.email" /><br/><input type="radio" name="verificationType" value="0" ><bean:message key="label.ver.none" /><br/></td>
						</tr>
						<tr>
							<td class="black-smalltext" valign="top" align="left"><bean:message key="label.ver.sub" /></td>
							<td class="textbox"><input type="text" name="verificationEmailSub" size="<%=sInputSize%>" maxlength="40" class="textbox" value="" /></td>
						</tr>
						<tr>
							<td class="black-smalltext" valign="top" align="left"><bean:message key="label.ver.msg" /><br><b class="blue-xsmalltext"><bean:message key="label.max.limit" arg0="255"/></b></td>
							<td class="textbox"><TEXTAREA name="verificationEmailMsg" rows="10" cols="<%=sTextCols%>" class="textarea-smalltext" onkeyup="checkLength('verificationEmailMsg');"	onmouseout="checkLength('verificationEmailMsg');" ></TEXTAREA></td>
						</tr>
						<tr>
							<td class="black-smalltext" valign="top" align="left"><bean:message key="label.not.addr" /></td>
							<td class="textbox"><TEXTAREA name="emailAddresses" rows="3" cols="<%=sTextCols%>" class="textarea-smalltext" onkeyup="checkLength('emailAddresses');" onmouseout="checkLength('emailAddresses');" ></TEXTAREA></td>
						</tr>
						<tr>
							<td class="black-smalltext" valign="top" align="left"><bean:message key="label.not.sub" /></td>
							<td class="textbox"><input type="text" name="notificationEmailSub" size="<%=sInputSize%>" maxlength="40" class="textbox" value="" /></td>
						</tr>
						<tr>
							<td class="black-smalltext" valign="top" align="left"><bean:message key="label.not.msg" /><br><b class="blue-xsmalltext"><bean:message key="label.max.limit" arg0="255"/></b></td>
							<td><TEXTAREA name="notificationEmailMsg" rows="10" cols="<%=sTextCols%>" class="textarea-smalltext" onkeyup="checkLength('notificationEmailMsg');"	onmouseout="checkLength('notificationEmailMsg');"></TEXTAREA></td>
						</tr>
						<tr>
							<td class="black-smalltext" valign="top" align="left"><bean:message key="label.tags" /><br><b class="blue-xsmalltext"><bean:message key="label.max.limit" arg0="255"/></b></td>
							<td class="black-smalltext"><TEXTAREA name="tags" rows="3" cols="<%=sTextCols%>" class="textarea-smalltext" onkeyup="checkLength('tags');" onmouseout="checkLength('tags');" ></TEXTAREA></td>
						</tr>
						<tr>
							<%if(oConfigForm.getType().equals(IContactConstants.TYPE_DEACTIVATED)){%>
								<td>&nbsp;</td>
								<td align="left"><a class="link-nounderline" href="#" ><img src="<%=imagePath%>/button-preview.jpg" border="0" onclick="preview('2');" alt="preview" /></a>&nbsp;<a class="link-nounderline" href="#" accesskey="enter"><img border="0" src="<%=imagePath%>/button-confirm-red.jpg" onclick="submitForm('<%=IContactConstants.REQ_PTR_STEP_SAVE%>')" alt="confirm"/></a></td>
							<%}else{%>
								<td>&nbsp;</td>
								<td align="left"><a class="link-nounderline" href="#" ><img src="<%=imagePath%>/button-preview.jpg" border="0" onclick="preview('3');" alt="preview" /></a>&nbsp;<a class="link-nounderline" href="#" accesskey="enter"><img border="0" src="<%=imagePath%>/button-confirm-red.jpg" onclick="submitNewForm('<%=IContactConstants.REQ_PTR_STEP_SAVE%>','<%=IContactConstants.TYPE_ACTIVATED_SEPARATE%>');" alt="confirm"/></a></td>
							<%}%>
						</tr>
					</table>
				</td>
			</tr>
			<%if(!oConfigForm.getType().equals(IContactConstants.TYPE_DEACTIVATED)){%>
			</form>
			<tr bgcolor="#CCCCCC" valign="middle"><td colspan="4" height="8px"><img width="100%" height="2px" src="<%=imagePath%>/dotted-line.gif" /></td></tr>
			<tr bgcolor="#CCCCCC">
				<td colspan="2">&nbsp;</td>
				<td colspan="2" height="8px" valign="bottom"><a class="link-nounderline" href="#" ><img border="0" src="<%=imagePath%>/button-deactivate-contact.jpg" onclick="submitEditForm('<%=IContactConstants.REQ_PTR_STEP_SAVE%>','<%=IContactConstants.TYPE_DEACTIVATED%>');" alt="deactivate"/></a></td>
			</tr>
			<tr bgcolor="#CCCCCC" valign="middle"><td colspan="4" height="8px"><img width="100%" height="2px" src="<%=imagePath%>/dotted-line.gif" /></td></tr>
			<%}else{%>		
			</form>	
			<%}%>
			<tr bgcolor="#999999" height="10px">
				<td><img src="<%=imagePath%>/grey-square.gif"></td>
				<td colspan="2" height="10px">&nbsp;</td>
				<td><img src="<%=imagePath%>/grey-square.gif"></td>
			</tr>
		</table>
	</td>
</tr>
<!------------------------------------>
</table>
</td>
</tr>
</table>
<form action="/icontact/Preview" name="PreviewForm" method="post" target="_blank">
	<input type="hidden" name="synonym" />
	<input type="hidden" name="displayName" />
	<input type="hidden" name="displayMsg" >
	<input type="hidden" name="tags" >
	<input type="hidden" name="verificationType" >
	<input type="hidden" name="sameAsSynonyms" />
</form>
</body>
</html>
